<?php
<html>
<body>
<?php
 
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("loc_fil") or die(mysql_error());

//This checks to see if there is a page number. If not, it will set it to page 1 
if (isset($_GET['page'])) 
{ 
$page = $_GET['page'];
$page=mysql_real_escape_string($page); 
}
else $page=1;

//Here we count the number of results 
//Edit $data to be your query 
$result = mysql_query("SELECT * FROM parks") or die(mysql_error()); 
$rows = mysql_num_rows($result);

//This is the number of results displayed per page 
$per_page = 5;

//This tells us the page number of our last page 
$total_pages = ceil($rows/$per_page);
echo"you are on page $page of $total_pages<br/>";
if($page!=1)
{ echo "<a href='newfile.php?page=1'><<First</a>"." ";
  $previous=$page-1;
  echo "<a href='newfile.php?page=$previous'><<Previous</a>";
}
if(($page!=1)&&($page!=total_pages))
  echo "|";
  
  if($page!= $total_pages)
  { $next=$page+1;
    echo"<a href='newfile.php?page=$next'>Next>></a>"." ";
    echo"<a href='newfile.php?page=$total_pages'>Last>></a>";
  }
  echo "<hr><br/>";
  
  $x=($page-1)*$per_page;
  $sql="SELECT * FROM parks limit $x,$per_page";
  $result=mysql_query($sql);
  ?> 
<table border="1">
<tr>
<th>R_id</th>
<th>R_Name</th>
</tr>
<?php
while($row = mysql_fetch_array($result))
 {?>
<tr>
<td><?php echo $row['P_id']?> </td>
<td><?php echo $row['P_Name']?> </td>
</tr>
 <?
 }
 ?>
</table>
<?
  	?>
  	</body>
  	</html>